<?php include TMPL_PATH.'public/header.phtml';?>

<?php if(ACTION_NAME=='index') {?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a class="on" href="javascript:;"><em>菜单管理</em></a><span>|</span><a href="<?php echo U('menu/add');?>"><em>添加菜单</em></a>    </div>
</div>
<form name="myform" action="<?php echo U('menu/listorder');?>" method="post">
<div class="pad-lr-10">
	<div class="table-list">
    <table width="100%" cellspacing="0">
        <thead>
            <tr>
            <th width="80">排序</th>
            <th width="100">id</th>
            <th>菜单英文名称</th>
			<th>管理操作</th>
            </tr>
        </thead>
	<tbody>
	<?php echo $categorys;?>

	</tbody>
    </table>
  
    <div class="btn"><input type="submit" class="button" name="dosubmit" value="排序" /></div>
  </div>
</div>
</form>

<?php } elseif(ACTION_NAME=='add') {?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href="<?php echo U('menu/index');?>"><em>菜单管理</em></a><span>|</span><a class="on" href="javascript:;"><em>添加菜单</em></a>    </div>
</div>
<script type="text/javascript">
<!--
$(function(){
	$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
	$("#name").formValidator({onshow:"请输入菜单名称",onfocus:"请输入菜单名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入菜单名称"});
	$("#m").formValidator({onshow:"请输入模块名",onfocus:"请输入模块名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入模块名"});
	$("#c").formValidator({onshow:"请输入文件名",onfocus:"请输入文件名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入文件名"});
	$("#a").formValidator({tipid:'a_tip',onshow:"请输入方法名",onfocus:"请输入方法名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入方法名"});
})
//-->
</script>
<div class="common-form">
<form name="myform" id="myform" action="<?php echo U('admin/menu/add');?>" method="post">
<table width="100%" class="table_form contentWrap">
      <tr>
        <th width="200">上级菜单：</th>
        <td><select name="info[parentid]" >
        <option value="0">作为一级菜单</option>
<?php echo $select_categorys;?>
</select></td>
      </tr>
      <tr>
        <th>菜单名称：</th>
        <td><input type="text" name="info[name]" id="name" class="input-text" ></td>
      </tr>
      <tr>
        <th>文件名：</th>
        <td><input type="text" name="info[c]" id="c" class="input-text" ></td>
      </tr>
	<tr>
        <th>方法名：</th>
        <td><input type="text" name="info[a]" id="a" class="input-text" > <span id="a_tip"></span>通过AJAX 传递的方法，请使用 ajax_开头，方法为修改或删除操作时，请对应写成，ajax_edit_myaction/ajax_delete_myaction</td>
      </tr>
	<tr>
        <th>附加参数：</th>
        <td><input type="text" name="info[data]" class="input-text" ></td>
      </tr>
  <tr>
        <th>排序：</th>
        <td><input type="text" name="info[listorder]" class="input-text" value="0" /></td>
      </tr>
	<tr>
        <th>是否显示菜单：</th>
        <td><input type="radio" name="info[display]" value="1" checked> 是<input type="radio" name="info[display]" value="0"> 否</td>
      </tr>
</table>
<!--table_form_off-->
    <div class="bk15"></div>
	<div class="btn"><input type="submit" id="dosubmit" class="button" name="dosubmit" value="提交"/></div>


</form>
</div>
<?php } elseif(ACTION_NAME=='edit') {?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href="<?php echo U('menu/index');?>"><em>菜单管理</em></a><span>|</span><a class="on" href="javascript:;"><em>编辑菜单</em></a>    </div>
</div>
<script type="text/javascript">
<!--
$(function(){
	$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
	$("#name").formValidator({onshow:"请输入菜单名称",onfocus:"请输入菜单名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入菜单名称"});
	$("#m").formValidator({onshow:"请输入模块名",onfocus:"请输入模块名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入模块名"});
	$("#c").formValidator({onshow:"请输入文件名",onfocus:"请输入文件名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入文件名"});
	$("#a").formValidator({tipid:'a_tip',onshow:"请输入方法名",onfocus:"请输入方法名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入方法名"});
})
//-->
</script>
<div class="common-form">
<form name="myform" id="myform" action="<?php echo U('menu/edit');?>" method="post">
<table width="100%" class="table_form contentWrap">
      <tr>
        <th width="200">上级菜单：</th>
        <td><select name="info[parentid]" >
        <option value="0">作为一级菜单</option>
<?php echo $select_categorys;?>
</select></td>
      </tr>
      <tr>
        <th>菜单名称：</th>
        <td><input type="text" name="info[name]" id="name" class="input-text" value="<?php echo $menu['name']?>"></td>
      </tr>
      <tr>
        <th>文件名：</th>
        <td><input type="text" name="info[c]" id="c" class="input-text" value="<?php echo $menu['c']?>"></td>
      </tr>
	<tr>
        <th>方法名：</th>
        <td><input type="text" name="info[a]" id="a" class="input-text" value="<?php echo $menu['a']?>"> <span id="a_tip"></span>通过AJAX 传递的方法，请使用 ajax_开头，方法为修改或删除操作时，请对应写成，ajax_edit_myaction/ajax_delete_myaction</td>
      </tr>
	<tr>
        <th>附加参数：</th>
        <td><input type="text" name="info[data]" class="input-text" value="<?php echo $menu['data']?>"></td>
      </tr>
  <tr>
        <th>排序：</th>
        <td><input type="text" name="info[listorder]" class="input-text" value="<?php echo $menu['listorder']?>" ></td>
      </tr>
	<tr>
        <th>是否显示菜单：</th>
        <td><input type="radio" name="info[display]" value="1" <?php if($menu['display']) echo 'checked';?>> 是<input type="radio" name="info[display]" value="0" <?php if(!$menu['display']) echo 'checked';?>> 否</td>
      </tr>
</table>
<!--table_form_off-->

    <div class="bk15"></div>
	<input name="id" type="hidden" value="<?php echo $menu['id']?>">
    <div class="btn"><input type="submit" id="dosubmit" class="button" name="dosubmit" value="提交"/></div>
</form>
</div>
<?php }?>
</body>
</html>